#
#  Copyright 2022 The Open Islands Authors. All Rights Reserved.
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#


import abc
import typing
from abc import ABCMeta

from pyoi.types import DataIO
from pyoi.types import FederatedAddress
from ._garbage_collection import GarbageCollectionABC


class ContextABC(metaclass=ABCMeta):
    @property
    @abc.abstractmethod
    def context_id(self) -> str:
        ...

    @property
    @abc.abstractmethod
    def role(self) -> str:
        ...

    @property
    @abc.abstractmethod
    def node_id(self) -> str:
        ...

    @property
    @abc.abstractmethod
    def nodes(self):
        ...

    @abc.abstractmethod
    def load_standard_text(self, dataio: DataIO):
        ...

    @abc.abstractmethod
    def load_nonstandard_text(self, dataio: DataIO):
        ...

    @abc.abstractmethod
    def get(self, name: str,
            tag: str,
            src_addresses: typing.List[FederatedAddress],
            gc: GarbageCollectionABC) -> typing.List:
        ...

    @abc.abstractmethod
    def remote(self, v,
               name: str,
               tag: str,
               dest_addresses: typing.List[FederatedAddress],
               gc: GarbageCollectionABC) -> typing.NoReturn:
        ...

    @abc.abstractmethod
    def cleanup(self) -> typing.NoReturn:
        ...

    @abc.abstractmethod
    def stop(self):
        ...

    @abc.abstractmethod
    def kill(self):
        ...
